let showMem = function() {
  let mem = process.memoryUsage()
  let format = function(bytes) {
    return (bytes / 1024 / 1024).toFixed(2) + 'MB'
  }
  console.log('Process: heapTotal' + format(mem.heapTotal) + 'heapUsed' + format(mem.heapUsed) + 'rss' + format(mem.rss))
  console.log('---------------------------------------')
}

let useMem = function() {
  let size = 200 * 1024 * 1024
  let buffer = Buffer(size)
  for (let i = 0; i < size; i++) {
    buffer[i] = 0
  }
  return buffer
}

let total =[]

for (let j = 0; j < 15; j++) {
  showMem()
  total.push(useMem())
}

showMem()